# celery.py

from __future__ import absolute_import, unicode_literals
import os
from celery import Celery

# 设置 Django settings 模块
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'first_end.settings')

# 创建 Celery 应用实例
app = Celery('first_end')
app.conf.broker_connection_retry_on_startup = True
# 加载配置信息
app.config_from_object('django.conf:settings', namespace='CELERY')

# 自动发现任务
app.autodiscover_tasks()

if __name__ == '__main__':
    app.start()
